<?php
	session_start();
	$which=$_POST['which'];
	include('system/db/conn.php');

	if($which==0){
		$menueName=$_POST['menueName'];
		$supplier_location_id=$_POST['supplier_location_id'];
		$sql = "INSERT INTO do_supplier_location_menu_cate(name,is_delete,is_effect,sort,supplier_location_id) VALUES('$menueName',0,1,1,'$supplier_location_id')";

		if(mysql_query($sql,$conn)){
			print_r("插入成功");
		}

	}elseif ($which==1) {
		$menueid=$_POST['menueTopid'];
		$sql1 = "select * from do_supplier_location_menu  where cate_id =$menueid";

		$query_firstmenu = mysql_query($sql1,$conn);
		$row=mysql_num_rows($query_firstmenu);

		if($row > 0){
			//print_r("请先删除此分类下的菜品再进行操作！");
			echo 'fail';
			//exit();
		}else{//
			$sql = "delete from do_supplier_location_menu_cate where id=$menueid";
			if(mysql_query($sql,$conn)){
				//print_r("success");
				echo 'success';
			}
		}
	}elseif($which==2){
	     $menueid=$_POST['menueBigid'];
	     $menueBigName=$_POST['menueBigName'];
		$sql = "update do_supplier_location_menu_cate set name='$menueBigName' where id=$menueid";
		print_r($sql);
		if(mysql_query($sql,$conn)){
			//print_r("修改成功");
			echo 'success';
		}
	}

?>